package com.handu.luna.core.domain.advertisement;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.handu.luna.core.domain.BaseRepository;
import com.handu.luna.core.domain.advertisement.AdPositionId.BelongPage;


public interface AdPositionIdRepository extends JpaRepository<AdPositionId,Long>, BaseRepository<AdPositionId>,JpaSpecificationExecutor<AdPositionId>{

	@Query("from AdPositionId a where a.adPositionSymbol=:adPositionSymbol and a.id<>:id")
	List<AdPositionId> findOneBySymbol(@Param("id") long id,@Param("adPositionSymbol") String adPositionSymbol);
	
	/**
	 * 首页 获得所有的广告位  lxx
	 */
	@Query("from AdPositionId where belongPage=:belongPage")
	List<AdPositionId> findAllAdPositions(@Param("belongPage") BelongPage belongPage);
}
